<?php
// 本类由系统自动生成，仅供测试用途
class LogonAction extends HomeAction {

     public function index(){
         
        $username=$_GET['username'];
        $email=$_GET['email'];
        
        $user=M('Coodt_user');
         
        //if($data=$user->create()){
            $data['name']=$_GET['username'];
            $data['email']=$_GET['email'];
            $data['phonr']=$_GET['phone'];
            $id=$user->add($data);
            if($id){
               echo ("ok");
            }else{ 
                echo ("errors");  
             }
            
       // }else{
            
        //    $this->error("error");
            
        //}

     }
     public function logon() {
         
        $user=M('Coodt_user');
         
        //if($data=$user->create()){
            $data['phone']=$_POST['phone'];
            if($list=$user->where($data)->find()){
                  $json_list= json_encode($list);
                  echo $json_list;
            }else{
                   $data['name']=$_POST['username'];
                   $data['email']=$_POST['email'];
                   $id=$user->add($data);
                   if($id){
                       echo ("ok");
                   }else{ 
                       echo ("error"); 
                   }
            }
         
     }

}